package org.msfj.admin.data.controller;

import org.msfj.admin.model.MessageFiled;
import org.msfj.admin.vo.MessageFiledVo;
import org.msfj.admin.model.MessageFiled;
import org.msfj.admin.vo.MessageFiledVo;
import org.msfj.admin.model.MessageFiled;
import org.msfj.admin.vo.MessageFiledVo;
import org.msfj.admin.data.service.MessageFiledService;
import org.springframework.beans.factory.annotation.Autowired;
import org.msfj.common.base.BaseController;
import org.msfj.common.model.CommonResult;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Description: 系统短信字段信息controller
 * @Author: like
 * @Email: like@deyatong.com
 * @Date: 2017-08-24 16:05:31
 * @Version: 1.0
 * @Created in idea by autoCode
 */
@Api(value = "系统短信字段信息接口", tags = "系统短信字段信息接口")
@RestController
@RequestMapping("data/messageFiled")
public class MessageFiledController extends BaseController{

    @Autowired
    private MessageFiledService messageFiledService;

    /**
     * 添加系统短信字段信息
     *
     * @param messageFiledVo
     * @return CommonResult.ok(MessageFiledVo)
     */
    @RequestMapping("/add")
    @ApiOperation(value = "添加系统短信字段信息",notes = "添加系统短信字段信息")
    @ApiImplicitParam(value = "messageFiledVo",name = "messageFiledVo",dataType = "org.msfj.admin.vo.MessageFiledVo",paramType = "query")
    public CommonResult addMessageFiled(MessageFiledVo messageFiledVo){
        MessageFiled messageFiled = messageFiledService.saveOrEdit(messageFiledVo);
        return CommonResult.ok(messageFiledService.setOtherProperties(messageFiled));
    }

    /**
     * 修改系统短信字段信息
     *
     * @param messageFiledVo
     * @return CommonResult.ok(MessageFiledVo)
     */
    @RequestMapping("/edit")
    @ApiOperation(value = "修改系统短信字段信息",notes = "修改系统短信字段信息")
    @ApiImplicitParam(value = "messageFiledVo",name = "messageFiledVo",dataType = "org.msfj.admin.vo.MessageFiledVo",paramType = "query")
    public CommonResult editMessageFiled(MessageFiledVo messageFiledVo){
        MessageFiled messageFiled = messageFiledService.saveOrEdit(messageFiledVo);
        return CommonResult.ok(messageFiledService.setOtherProperties(messageFiled));
    }

    /**
     * 逻辑删除系统短信字段信息
     *
     * @param messageFiledVo
     * @return CommonResult.ok(MessageFiledVo)
     */
    @RequestMapping("/del")
    @ApiOperation(value = "逻辑删除系统短信字段信息",notes = "逻辑删除系统短信字段信息")
    @ApiImplicitParam(value = "messageFiledVo",name = "messageFiledVo",dataType = "org.msfj.admin.vo.MessageFiledVo",paramType = "query")
    public CommonResult delMessageFiled(MessageFiledVo messageFiledVo){
        MessageFiled messageFiled = messageFiledService.delById(messageFiledVo);
        return CommonResult.ok(messageFiledService.setOtherProperties(messageFiled));
    }

    /**
     * 逻辑删除系统用户信息
     * @param ids
     * @return CommonResult.ok()
     */
    @RequestMapping("/dels")
    @ApiOperation(value = "逻辑删除系统短信字段信息",notes = "逻辑删除系统短信字段信息")
    @ApiImplicitParam(value = "ids[]",name = "ids[]",dataType = "java.util.List",paramType = "query")
    public CommonResult delUsers(@RequestParam(value = "ids[]",required = false) List<String> ids){
        MessageFiled messageFiled = new MessageFiled();
        messageFiledService.delByIds(ids, messageFiled);
        return CommonResult.ok();
    }

    /**
     * 真实删除系统短信字段信息
     *
     * @param messageFiledVo
     * @return CommonResult.ok()
     */
    @RequestMapping("/delete")
    @ApiOperation(value = "真实删除系统短信字段信息",notes = "真实删除系统短信字段信息")
    @ApiImplicitParam(value = "messageFiledVo",name = "messageFiledVo",dataType = "org.msfj.admin.vo.MessageFiledVo",paramType = "query")
    public CommonResult deleteMessageFiled(MessageFiledVo messageFiledVo){
        messageFiledService.trueDelById(messageFiledVo);
        return CommonResult.ok();
    }

    /**
     * 根据id查找系统短信字段信息
     *
     * @param messageFiledVo
     * @return CommonResult.ok(MessageFiledVo)
     */
    @RequestMapping("/get")
    @ApiOperation(value = "根据id查找系统短信字段信息",notes = "根据id查找系统短信字段信息")
    @ApiImplicitParam(value = "messageFiledVo",name = "messageFiledVo",dataType = "org.msfj.admin.vo.MessageFiledVo",paramType = "query")
    public CommonResult getMessageFiled(MessageFiledVo messageFiledVo){
        MessageFiled messageFiled = messageFiledService.getById(messageFiledVo.getId());
        return CommonResult.ok(messageFiledService.setOtherProperties(messageFiled));
    }

    /**
     * 根据翻页参数、搜索参数查找系统短信字段信息
     *
     * @param messageFiledVo
     * @param page 当前第几页
     * @param rows 每页多少条记录
     * @return CommonResult.ok(PageInfo<MessageFiledVo>)
     */
    @RequestMapping("/list")
    @ApiOperation(value = "根据翻页参数、搜索参数查找系统短信字段信息",notes = "根据翻页参数、搜索参数查找系统短信字段信息")
    @ApiImplicitParams({
        @ApiImplicitParam(value = "messageFiledVo",name = "messageFiledVo",dataType = "org.msfj.admin.vo.MessageFiledVo",paramType = "query"),
        @ApiImplicitParam(name = "page",value = "page",dataType = "Integer",paramType = "path"),
        @ApiImplicitParam(name = "rows",value = "rows",dataType = "Integer",paramType = "path")
    })
    public CommonResult findMessageFiledList(MessageFiledVo messageFiledVo, Integer page, Integer rows){
        PageInfo<MessageFiledVo> messageFiledVoPageInfo = messageFiledService.getByMessageFiled(messageFiledVo,page,rows);
        return CommonResult.ok(messageFiledVoPageInfo);
    }

    /**
     * 根据搜索参数查找所有系统短信字段信息
     *
     * @param messageFiledVo
     * @return CommonResult.ok(List<MessageFiledVo>)
     */
    @RequestMapping("/getAll")
    @ApiOperation(value = "根据搜索参数查找所有系统短信字段信息",notes = "根据搜索参数查找所有系统短信字段信息")
    @ApiImplicitParam(value = "messageFiledVo",name = "messageFiledVo",dataType = "org.msfj.admin.vo.MessageFiledVo",paramType = "query")
    public CommonResult getAllMessageFiled(MessageFiledVo messageFiledVo){
        List<MessageFiledVo> messageFiledVoList = messageFiledService.getAllMessageFiled(messageFiledVo);
        return CommonResult.ok(messageFiledVoList);
    }
}
